﻿using UnityEngine;
using System.IO;
#if UNITY_EDITOR
using UnityEditor;
#endif
public class GenerateFolders
{
#if UNITY_EDITOR

    [MenuItem("Tools/快速创建基础目录")]
    private static void CreateAllFolder()
    {
        GenerateFolder();
        Debug.Log("成功创建目录");
    }
    [MenuItem("Tools/打开Config目录")]
    private static void OpenConfigDirectory()
    {
        if (!Directory.Exists(Global.ConfigPath))
        {
            Directory.CreateDirectory(Global.ConfigPath);
        }
        System.Diagnostics.Process.Start(Global.ConfigPath);
    }

    [MenuItem("Tools/打开app目录")]
    private static void OpenAPPDirectory()
    {
        if (!Directory.Exists(Global.appPath))
        {
            Directory.CreateDirectory(Global.appPath);
        }
        System.Diagnostics.Process.Start(Global.appPath);
    }
    private static void GenerateFolder()
    {
        // 文件路径
        string prjPath = Application.dataPath + "/";
        Directory.CreateDirectory(prjPath + "Art");
        Directory.CreateDirectory(prjPath + "Editor");
        Directory.CreateDirectory(prjPath + "Plugins");
        Directory.CreateDirectory(prjPath + "Art/Texture2D");
        Directory.CreateDirectory(prjPath + "Art/Sprites");
        Directory.CreateDirectory(prjPath + "Art/FBX");
        Directory.CreateDirectory(prjPath + "Art/Mat");
        Directory.CreateDirectory(prjPath + "Art/Shader");
        Directory.CreateDirectory(prjPath + "Art/Audio");
        Directory.CreateDirectory(prjPath + "ExternalLibraries");
        Directory.CreateDirectory(prjPath + "Prefabs");
        Directory.CreateDirectory(prjPath + "Resources");
        Directory.CreateDirectory(prjPath + "Scripts");
        Directory.CreateDirectory(prjPath + "Scenes");
        Directory.CreateDirectory(prjPath + "StreamingAssets");
       
        AssetDatabase.Refresh();
    }
#endif
}